const fs = require('fs')

const content = (res, pathName) => {
  fs.readFile(`./view/${pathName}.html`, (err, data)=>{
    res.writeHead(200, {'Content-Type': 'text-plain'})
    res.write(data)
    res.end()
  })
}

const home = (res) => {
  console.log(`Request handler home was called`)

  content(res, 'index')
}

const about = (res) => {
  console.log(`Request handler about was called`)

  content(res, 'about')
}

exports.home = home
exports.about = about